package cn.jiyun.function.service.impl;

import cn.jiyun.function.mapper.DemandMapper;
import cn.jiyun.function.service.DemandService;
import cn.jiyun.pojo.DailyRecord;
import cn.jiyun.pojo.function.DemandSensitiveWord;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DemandServiceImpl implements DemandService {
    @Autowired
    DemandMapper demandMapper;

    @Override
    public PageInfo<DemandSensitiveWord> findAll(Integer pageNum, Integer pageSize, DemandSensitiveWord demandSensitiveWord) {
        Page<DemandSensitiveWord> demandSensitiveWordPage = PageHelper.startPage(pageNum, pageSize);
        List<DemandSensitiveWord> demandSensitiveWordList = demandMapper.findPage(demandSensitiveWordPage,demandSensitiveWord);

        return new PageInfo<>(demandSensitiveWordList);
    }

    @Override
    public void insertDemand(DemandSensitiveWord demand) {
        demandMapper.insertDemand(demand);
    }

    @Override
    public DemandSensitiveWord findById(Integer id) {
        return demandMapper.findById(id);
    }

    @Override
    public void updateDemand(DemandSensitiveWord demand) {
        demandMapper.updateDemand(demand);
    }

    @Override
    public List<String> findAll1() {
        return demandMapper.findAll1();
    }


}
